package chap03;

import java.awt.*;

public class inner {
    public static void main(String [] args)
    {
        Sample sample=new Sample();
        Sample.Inner inner=sample.new Inner();
        inner.print();
        System.out.println("the second of case");
        SampleTest3.Apple apple=new SampleTest3.Apple(8);
        System.out.println("他的零售价为:" + apple.innerPrice + "元");
    }
}
class Sample{
    public int id ;
    private String name;
    static String type;
    public Sample(){
        this.id=3246;
        this.name="苹果";
        this.type="水果";
    }
    class Inner{    //局部内部类 Local inner class
        private String message="inner class have some attributes";
        public void print(){
            System.out.println(this.message);
            System.out.println(name);
            System.out.println(type);
        }
    }
}
class SampleTest3{
    private static String name;
    public SampleTest3(){
        this.name = "苹果";
    }
    static class Apple{
        int innerPrice= 0;
        public Apple(int price)
        {
            innerPrice =price;
        }
        public void introdution(){
            System.out.println("这是一个"+name);
            System.out.println("他的零售价为:"+innerPrice+"元");
        }
    }
}



